home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / rt.asm < prev   
Assembly Source File  |  1994-04-25  |  18KB  |  515 lines

  1. ;
  2. ; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
  3. ; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
  4. ; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
  5. ; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
  6. ; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
  7. ; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
  8. ; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
  9. ; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
  10. ;
  11. ;
  12.  
  13.                 .model  tiny
  14.  
  15. ;
  16. ;
  17. ;
  18. ;                                 ____
  19. ;                                │_^^_│ -Project-
  20. ;                                ├/__\┤ -N--e--w-
  21. ;                                /\__/\ -A--g--e-
  22. ;
  23. ;                                 VGA Loader #19
  24. ;                              ASM Source/Comments
  25. ;
  26. ;              this is a simple vga loader, nothing special about it
  27. ;              (originally made for the technodrome bbs), but with
  28. ;              comments for beginners or average programmers.
  29. ;  Disclaimer: we disterbute the source because we want you to use it...
  30. ;              but we ask:  1) if you ripoff the source to make a new
  31. ;              one give us some credit... 2) if you disterbute a modified
  32. ;              source, dont remove or modify our comments in the src code
  33. ;  Questions/Comments:
  34. ;              Send to any one of the programmers here,
  35. ;              TonyHawk/ViRGO/V@N0R/MegaBst/Tera Versial/Danken-M/Deux2
  36. ;
  37. ;              call Tower of Power or The TechnoDrome, or contact via email:
  38. ;              TonyHawk: jeed@maia.au.ac.th             (temp address)
  39. ;              ViRGO   : ask                            (temp address)
  40. ;              Tera Vr.: amos@phys4.technion.ac.il      (temp address)
  41. ;              Deux-2  : cyrus@issue.cs.technion.ac.il  (temp address)
  42. ;
  43.  
  44. code segment byte public
  45. assume cs:code,ds:code
  46. ;.code
  47.  
  48. org 256
  49.  
  50. start:
  51. jmp begin_intro
  52.  
  53.  
  54. initcol db    4
  55. message db 35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35
  56.         db 35,35,35,35,35,35,35,35,35,35,35,35,35,35,0,35,35,35,35,35
  57.         db 126,126,126,126,35,35,35,35,126,126,126,35,35,35,126,126,35
  58.         db 35,35,126,126,126,126,126,35,35,35,35,35,0,35,35,35,35,126
  59.         db 126,35,35,35,126,126,35,35,126,126,126,126,35,35,126,126
  60.         db 35,35,126,126,35,35,35,126,126,35,35,35,35,0,35,35,35,35,126
  61.         db 126,35,35,126,126,126,35,35,126,126,126,126,126,35,126,126,35
  62.         db 35,126,126,126,126,126,126,126,35,35,35,35,0,35,35,35,35,126
  63.         db 126,126,126,126,35,35,35,35,126,126,35,35,126,126,126,126,35
  64.         db 35,126,126,126,126,35,126,126,35,35,35,35,0,35,35,35,35,126
  65.         db 126,35,35,35,35,35,35,35,126,126,35,35,35,126,126,126,35,35
  66.         db 126,126,35,35,35,126,126,35,35,35,35,0,35,35,35,35,126,126,35
  67.         db 35,35,35,35,35,35,126,126,35,35,35,35,126,126,35,35,126,126,35
  68.         db 35,35,126,126,35,35,35,35,0,35,35,35,35,35,35,35,35,35,35,35,35
  69.         db 35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35
  70.         db 35,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
  71.         db 32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,2,32,32,32,32,32
  72.         db 32,32,32,111,114,105,103,105,110,97,108,108,121,32,109,97,100
  73.         db 101,32,102,111,114,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32
  74.         db 32,42,32,116,104,101,32,116,101,99,104,110,111,100,114,111,109
  75.         db 101,32,42,32,32,32,32,32,32,32,0,32,32,32,97,32,115,105,109,112
  76.         db 108,101,32,118,103,97,32,108,111,97,100,101,114,32,98,121,32,116
  77.         db 104,47,116,101,114,97,32,0,0,3,32,32,32,32,32,32,32,32,32,32,32
  78.         db 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
  79.         db 32,0,32,32,42,32,97,100,100,101,100,32,100,105,115,115,111,108,118
  80.         db 101,32,105,110,32,116,101,120,116,109,111,100,101,32,32,32,32,0,0
  81.         db 1,32,32,42,32,97,100,100,101,100,32,118,103,97,32,99,97,114,100,32
  82.         db 100,101,116,101,99,116,105,111,110,32,32,32,32,32,32,0,0,0,0,0,7,32
  83.         db 32,32,32,32,32,32,32,32,64,32,49,57,57,51,32,98,121,32,40,112,110,97
  84.         db 41,32,32,32,48,41,45,58,32,32,32,0,0,6,105,110,101,116,58,32,97,109
  85.         db 111,115,32,62,32,112,104,121,115,52,46,116,101,99,104,110,105,111,110
  86.         db 46,97,99,46,105,108,32,0,0,255
  87.  
  88. pic2pal db  60,60,0,55,55,0,50,50,0,45,45,0,40,40,0,35,35,0,30,30,0,60,0,60,55
  89.         db  0,55,50,0,50,45,0,45,40,0,40,35,0,35,30,0,30,0,60,0,0,55,0,0,50,0
  90.         db  0,45,0,0,40,0,0,35,0,0,30,0,60,60,60,55,55,55,50,50,50,45,45,45,40
  91.         db  40,40,35,35,35,30,30,30,0,60,60,0,55,55,0,50,50,0,45,45,0,40,40,0
  92.         db  35,35,0,30,30,60,0,0,55,0,0,50,0,0,45,0,0,40,0,0,35,0,0,30,0,0,60
  93.         db  0,30,55,0,28,50,0,26,45,0,24,40,0,24,35,0,22,30,0,20,60,30,30,55
  94.         db  28,28,50,26,26,45,24,24,40,24,24,35,22,22,30,20,20
  95. ;       db  'RotemBors ToolZ'
  96.  
  97. num_of_char_colors    db 8
  98. num_of_char_colors_2  db 7
  99. the_palette db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
  100.             db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2
  101.             db 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,2,3
  102.             db 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,2,1,2,3,4
  103.             db 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,3,2,1,2,3,4,5
  104.             db 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,4,3,2,1,2,3,4,5,5
  105.             db 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,3,2,1,2,3,4,4,4,4
  106.             db 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,2,1,2,3,3,3,3,3,3
  107.             db 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,2,2,2,2,2,2,2,2
  108.             db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1
  109.             db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2
  110.             db 2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3
  111.             db 3,3,2,1,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4
  112.             db 3,2,1,2,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,4,3
  113.             db 2,1,2,3,4,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,5,4,3,2
  114.             db 1,2,3,4,5,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,4,3,2,1
  115.             db 2,3,4,5,5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,4,4,4,4,4,4,4,4,4,4,3,2,1,2
  116.             db 3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,2,3
  117.             db 3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2
  118.             db 2,2,2,2,2,2,2,2,2,2,2,2,2
  119.  
  120. font_data db  10,10,30,10,10,35,10,10,40,10,10,45,10,10,50,10,10,55,126,241
  121.           db  241,255,241,241,241,254,241,241,254,241,241,254,127,240,240,240
  122.           db  240,240,127,254,241,241,241,241,241,254,255,240,240,252,240,240
  123.           db  255,255,240,240,252,240,240,240,127,240,240,243,241,241,127,241
  124.           db  241,241,255,241,241,241,126,60,60,60,60,60,126,31,15,15,15,15
  125.           db  15,254,241,241,242,252,242,241,241,240,240,240,240,240,240,255
  126.           db  254,245,245,245,245,245,245,254,241,241,241,241,241,241,126,241
  127.           db  241,241,241,241,126,254,241,241,254,240,240,240,126,241,241,241
  128.           db  243,243,127,254,241,241,254,241,241,241,127,240,240,126,15,15,254
  129.           db  255,60,60,60,60,60,60,241,241,241,241,241,241,126,241,241,241,241
  130.           db  122,60,24,245,245,245,245,245,245,122,241,241,122,60,122,241,241
  131.           db  143,143,143,127,15,15,254,255,15,30,60,120,240,255,0,0,0,0,0,60
  132.           db  60,0,0,0,0,0,56,112,0,60,60,0,60,60,0,0,0,0,60,0,0,0,0,0,24,60
  133.           db  24,0,0,0,60,126,126,126,60,0,255,255,255,255,255,255,255,31,60
  134.           db  60,60,60,60,31,248,60,60,60,60,60,248,0,32,127,255,127,32,0,0,4
  135.           db  254,255,254,4,0,60,60,60,60,60,0,60,126,143,15,62,60,0,60,15,15
  136.           db  30,60,120,240,240,240,240,120,60,30,15,15,60,124,60,60,60,60,126
  137.           db  126,143,15,126,240,240,255,254,15,15,62,15,15,254,240,240,240,255
  138.           db  15,15,15,255,240,240,254,15,15,254,127,240,240,254,241,241,126,255
  139.           db  15,30,60,60,60,60,126,241,241,126,241,241,126,126,143,143,127,15
  140.           db  15,254,126,241,241,241,241,241,126,60,66,153,161,153,66,60,234,78,74
  141.           db   0,0,0,0,0,0,0,0,0,0,0
  142.  
  143. chars_array     db 'abcdefghijklmnopqrstuvwxyz.,:-+*#()<>!?/\1234567890@~'
  144. blank_buf       db 0,0
  145.  
  146. palettes_buffer db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  147.                 db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  148.                 db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  149.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  150.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  151.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  152.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  153.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  154.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  155.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  156.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  157.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  158.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  159.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  160.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  161.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  162.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  163.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  164.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  165.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  166.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  167.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  168.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  169.                 db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  170. palettes_array db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  171.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  172.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  173.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  174.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  175.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  176.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  177.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  178.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  179.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  180.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  181.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  182.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  183.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  184.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  185.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  186.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  187.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  188.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  189.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  190.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  191.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  192.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  193.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  194.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  195.                db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  196.  
  197. out_byte        db    1
  198. number_of_three        dw    765
  199. copyright               db      '[PNA]$';
  200. no_vga_text             db      'You dont have a vga!!!$'
  201. flag dw 1
  202. count dw 0
  203.  
  204. begin_intro:
  205.      mov    bx,47104                ; memory address
  206.      mov    dx,2000                 ; full screen
  207. screen:  mov    es,bx                   ; screen segment
  208. diss:    mov    cx,dx                   ; bytes in screen
  209.      xor    bx,bx
  210.      xor    di,di
  211. mainloop:
  212.      mov    ax,es:[di]              ; get char
  213.      cmp    al,' '                  ; space?
  214.      jz     next                    ; yes = do nothing
  215.      cmp    al,' '                  ; space?
  216.      jl     increase                ; less than a space?
  217.      dec    al                      ; no = dec 1 2 space
  218.          jmp    movit
  219. increase:
  220.      inc    al                      ; inc 2 space
  221. movit:
  222.      mov    es:[di],ax
  223.      inc    bx                      ; set flag
  224. next:
  225.      inc    di                      ; next
  226.      inc    di
  227.      loop   mainloop                ; all bytes on screen
  228.      cmp    bx,00                   ; change anything???
  229.      jnz    diss                    ; continue until all spaces
  230.          xor bx,bx
  231.          mov ax,01A00h
  232.          int 10h                        ; check screen
  233.          cmp bl,7                       ; check screen type
  234.          jae vga1                       ; if vga then continue
  235.          mov dx,offset no_vga_text
  236.          mov ah,9                       ; display no vga message
  237.          int 21h
  238.          int 20h                        ; exit
  239. vga1:
  240.     mov ah,0
  241.     mov al,13h
  242.     int 10h            ; Set vga mode
  243.     cld
  244.     call load_pal                ; Load palette
  245.     call draw_wall               ;* I will add this tomorrow
  246.     call drawtext                ; Load the text into memory
  247.         call fadein                  ; Draw it...
  248.  
  249.  
  250. ; for 1.i
  251.  
  252.   graphics_loop:
  253.   call waitvrt;
  254. main_loop:
  255.  
  256. ; for 2.i
  257.  
  258. mov ah,1                   ;key?
  259. int 16h
  260. jnz exit_from_loader       ;exit
  261.     jmp graphics_loop
  262.     exit_from_loader:
  263.     call split_screen
  264.         mov    ah,0                    ; text mode
  265.         mov    al,3
  266.         int    10h
  267.  
  268.                 mov dx,offset copyright
  269.                 mov ah,9
  270.                 int 21h
  271.                 int 20h                         ; exit
  272.  
  273.  
  274. ; Split the screen
  275.  
  276. split_screen    proc    near
  277.         mov    cx,12
  278.  
  279.  
  280.  
  281. split_loop:
  282.         push    cx
  283.         mov    ah,6
  284.         mov    al,2
  285.         mov    ch,0
  286.         mov    cl,20
  287.         mov    dh,24
  288.         mov    dl,39
  289.         mov    bh,0
  290.         int    10h                     ; up
  291.  
  292.              mov    ah,7                    ; down
  293.         mov    al,2
  294.  
  295.         mov    ch,0
  296.         mov    cl,0
  297.         mov    dh,24
  298.         mov    dl,19
  299.         mov    bh,0
  300.             int    10h
  301.             pop    cx
  302.         loop    split_loop        ; split the screen
  303.  
  304.         retn
  305. split_screen    endp
  306.  
  307.  
  308. ; palette
  309. load_pal    proc    near
  310.         mov    dx,3C8h
  311.         mov    al,out_byte
  312.         out    dx,al            ; send to the vga
  313.         inc    dx
  314.         mov    si,offset palettes_array
  315.         mov    cx,number_of_three
  316. load_pal_loop:
  317.         lodsb
  318.         out    dx,al            ; make palette
  319.         loop    load_pal_loop
  320.         retn
  321. load_pal    endp
  322.  
  323.  
  324. ; Draw the background *I am too lazy to paint the picture..
  325. ; I will add it tomorrow
  326. draw_wall    proc    near
  327.         mov    ax,0A000h                 ; vga screen
  328.         mov    es,ax
  329.         xor    di,di
  330.         mov    cx,10
  331. draw_wall_loop:
  332.         push    cx                        ; save
  333.         mov    si,offset the_palette     ; the wall palette
  334.         mov    cx,20                     ; how much
  335.  
  336. big_print_wall:
  337.         push    cx
  338.         mov    cx,32                     ; how much
  339.  
  340. print_wall:
  341.     lodsb
  342.     inc    di
  343.     loop    print_wall
  344.  
  345. ; I will add this tomorrow
  346. ;*
  347.  
  348.     add    di,121h
  349.     pop    cx
  350.     loop    big_print_wall        ; if not done
  351.  
  352.         pop    cx
  353.     loop    draw_wall_loop
  354.  
  355.         retn
  356. draw_wall    endp
  357.  
  358.  
  359. ; Vertical retrace
  360. WaitVRT        proc    near
  361.         mov    dx,3DAh
  362. waitvrt_1:
  363.         in    al,dx
  364.         test    al,8
  365.         jnz    waitvrt_1
  366.         mov    cx,8
  367. waitvrt_2:
  368.         in    al,dx
  369.         test    al,8
  370.         jz    waitvrt_2
  371.         retn
  372. WaitVRT        endp
  373.  
  374.  
  375.  
  376. fadein        proc    near
  377.         mov    si,offset font_data
  378.         mov    di,851h
  379.         mov    cx,12h
  380.         rep    movsb
  381.         mov    si,offset pic2pal
  382.         mov    al,num_of_char_colors
  383.         mov    bl,21
  384.         mul    bl
  385.         mov    cx,ax
  386.         rep    movsb
  387.         mov    number_of_three,2E5h
  388.         mov    cx,64
  389.  
  390. fadein_loops:
  391.         push    cx
  392.         mov    cx,720                     ; number of colors
  393.         mov    si,offset palettes_buffer
  394.         mov    di,offset palettes_array
  395.  
  396. fadein_loops_1:
  397.         mov    al,[si]
  398.         mov    ah,[di]
  399.         cmp    al,ah           ; check colors
  400.         je    fadein_loops_2
  401.         inc    ah              ; next
  402.         mov    [di],ah
  403. fadein_loops_2:
  404.         inc    si
  405.         inc    di
  406.         loop    fadein_loops_1
  407.  
  408.         call    WaitVRT
  409.         call    load_pal
  410.         pop    cx
  411.         loop    fadein_loops   ; continue fade in
  412.  
  413.         retn
  414. fadein        endp
  415.  
  416.  
  417. ; Routine added by tonyhawk, temp address: jeed@maia.au.ac.th
  418. tonyhawks_routine proc    near
  419.         push    si
  420.         push    di
  421.         mov    cx,7
  422. th_loop_1:
  423.         push    cx
  424.         mov    dl,[si]
  425.         mov    cx,8
  426. th_loop_2:
  427.         shl    dl,1
  428.         jnc    th_main_loop_1
  429.         mov    es:[di],ah
  430. th_main_loop_1:
  431.         inc    di
  432.         loop    th_loop_2
  433.         inc    si
  434.         add    di,312
  435.         inc    ah
  436.         pop    cx
  437.         loop    th_loop_1
  438.         pop    di
  439.         pop    si
  440.         retn
  441. tonyhawks_routine endp
  442.  
  443.  
  444. build_text_arr    proc    near
  445.         mov    si,offset chars_array
  446. build_1:
  447.         lodsb
  448.         cmp    al,ah
  449.         jne    build_1
  450.         dec    si
  451.         sub    si,81Ah
  452.         mov    ax,si
  453.         mov    si,7
  454.         mul    si
  455.         mov    si,ax
  456.         add    si,1696
  457.         retn
  458. build_text_arr    endp
  459.  
  460.  
  461.  
  462. drawtext    proc    near
  463.         mov    word ptr blank_buf,1287
  464.         mov    di,1287
  465.         mov    bx,offset initcol
  466. check_chars_1:
  467.         mov    ah,[bx]
  468.         inc    bx
  469.         cmp    ah,' '       ; space bar??
  470.         je    its_space
  471.         cmp    ah,0FFh      ; is end?
  472.         jne    not_end
  473.         mov    ax,cs
  474.         mov    es,ax
  475.         retn
  476. not_end:
  477.         cmp    ah,0
  478.         jne    next_ln
  479.         mov    ax,word ptr blank_buf
  480.         add    ax,0A00h                  ; guess...
  481.         mov    word ptr blank_buf,ax
  482.         mov    di,ax
  483.                 jmp     check_chars_1
  484. next_ln:
  485.         cmp    ah,num_of_char_colors
  486.         jg    all_done
  487.         mov    al,ah
  488.         mov    cl,7
  489.         mul    cl
  490.         mov    num_of_char_colors_2,al
  491.                 jmp     check_chars_1
  492. all_done:
  493.         call    build_text_arr
  494.         mov    ah,num_of_char_colors_2
  495.         mov    al,ah
  496.         push    di
  497.         mov    ah,0F8h
  498.         add    di,offset message+60
  499.         call    tonyhawks_routine         ; black
  500.         pop    di
  501.         mov    ah,al
  502.                 call    tonyhawks_routine         ; full colors
  503. its_space:
  504.         add    di,9
  505.                 jmp     check_chars_1
  506. drawtext    endp
  507.  
  508.        palette:
  509.  
  510. code ends
  511.  
  512.  
  513.         end    start
  514.  
  515.